package cn.com.open.itembank.service;

import cn.com.open.itembank.entity.CourseItemBank;
import cn.com.open.itembank.entity.QuestionType;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by lucky on 2017/9/14.
 */

@FeignClient(name = "item-base-service")
public interface ItemBankRemoteService {
    /**
     * 根据题库id获取可用题库信息.
     *
     * @param itemBankId 题库id
     * @return 可用题库信息
     */
    @GetMapping(value = "/itemBank/{id}")
    CourseItemBank getCourseItemBankInfo(@PathVariable(value = "id") String itemBankId);

    /**
     * 判断给定的appkey是否拥有给定的题库id的管理权限，如果是题库所有者或者拥有超级权限均视为拥有权限.
     *
     * @param itemBankId 题库id
     * @param appKey     appkey
     * @return true ，拥有；false，不拥有
     */
    @GetMapping(value = "/itemBank/{id}/permission")
    boolean hasPermission(@PathVariable(value = "id") String itemBankId, @RequestParam("appId") String appKey);

    /**
     * 根据题库ID获取题型列表.
     *
     * @param itemBankId 题库id
     * @return 题型列表 question type list by item bank id
     */
    @GetMapping(value = "/itemBank/{id}/questiontypes")
    List<QuestionType> getListByItemBankId(@PathVariable(value = "id") String itemBankId);
}
